package com.tt.utils.wordUtils.entity;

import lombok.Data;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc;

import java.util.List;

/**
 * @Title: TableContent
 * @Author zl
 * @Package com.oberyun.goHAZOP.utils.wordUtils.entity
 * @Date 2025/9/8 11:29
 * @description: 表格数据
 */
@Data
public class TableContent {
    /**
     * 对应key
     */
    private String key;

    /**
     * 表格数据
     */
    private TableBody tableBody;

    public TableContent(String key, TableBody tableBody) {
        this.key = key;
        this.tableBody = tableBody;
    }

    @Data
    public static class TableBody{
        /**
         * 表头数据
         */
        private List<TableTitleData> titles;
        /**
         * 表格数据
         */
        private List<List<TableCellData>> body;
        /**
         * 列数
         */
        private Integer columnCount;
    }

    @Data
    public static class TableTitleData{
        /**
         * 单元格内容
         */
        private String content;

        /**
         * 单元格类型
         */
        private Integer type = 0;

        private Integer with ;

        public TableTitleData(String content) {
            this.content = content;
        }
    }

    /**
     * 单元格数据
     */
    @Data
    public static class TableCellData {
        /**
         * 单元格内容
         */
        private Object content;
        /**
         * 单元格类型 0 文本  1 图片 2 颜色
         */
        private Integer type;
        /**
         * 单元格宽度
         */
        private Double width;
        /**
         * 单元格内容对齐方式 默认居中对齐
         */
        private STJc.Enum stjc = STJc.CENTER;
        /**
         * 单元格对其方式
         */
        private XWPFTableCell.XWPFVertAlign verticalAlignment = XWPFTableCell.XWPFVertAlign.CENTER;

        public TableCellData(Object content, Integer type) {
            this.content = content;
            this.type = type;
        }
        public TableCellData(Object content, Integer type, STJc.Enum stjc) {
            this.content = content;
            this.type = type;
            this.stjc = stjc;
        }
    }

}


